<template>
	<view>
		<view class="Top">
			<image src="/static/logo.png" style="width: 160rpx;height: 160rpx;" mode=""></image>
			<view class="Title">
				欢迎注册华商城
			</view>
		</view>
		<view class="Form">
			<view class="Item">
				<view class="Left">
					账号
				</view>
				<view class="Input">
					<u-input placeholder="请输入账号" maxlength="20" placeholder-style="color: #fff;font-weight: 400;"
						color="#fff" border="none" v-model="username"></u-input>
				</view>
			</view>
			
			<view class="Item">
				<view class="Left">
					密码
				</view>
				<view class="Input">
					<u-input placeholder="输入密码" type="password" placeholder-style="color: #fff;font-weight: 400;"
						color="#fff" border="none" v-model="Password"></u-input>
				</view>
			</view>
			
			<view class="Item">
				<view class="Left">
					确认密码
				</view>
				<view class="Input">
					<u-input placeholder="确认密码" type="password" placeholder-style="color: #fff;font-weight: 400;"
						color="#fff" border="none" v-model="repassword"></u-input>
				</view>
			</view>
		

			<view class="Item">
				<view class="Left">
					推荐ID
				</view>
				<view class="Input">
					<u-input placeholder="请输入推荐id" :disabled="inds" style="color: #ffffff;font-weight: 400;"
						color="#fff" border="none" v-model="Invitecode"></u-input>
				</view>
			</view>
		</view>
		<view class="Btn">
			<view class="BtnC" @click="Reg">
				注册
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username:'',
				repassword:'',
				tips: '',
				Tel: '',
				Code: '',
				Password: '',
				Invitecode: '',
				Agreement: false,
				inds: false,
				ves: {},
				xid: ''
			};
		},
		onLoad(o) {
			
			if (uni.getStorageSync('invitecode')) {
				this.Invitecode = uni.getStorageSync('invitecode')
				this.inds = true
			}
		},
		methods: {
			
			Reg() {
				if(this.username.length == 0)
				{
					uni.$u.toast('请填写账号');
					return false;
				}
				/* if(this.Tel.length == 0)
				{
					uni.$u.toast('请填写手机号');
					return false;
				} */
				if(this.Invitecode.length == 0)
				{
					uni.$u.toast('请填写推荐ID');
					return false;
				}
				/* if(this.xid.length == 0)
				{
					uni.$u.toast('请填写血缘ID');
					return false;
				} */
				
				let data = {
					username: this.username,
					repassword: this.repassword,
					// mobile: random(1000000000,9999999999),
					code: this.Code,
					password: this.Password,
					invitecode: this.Invitecode,
					// xid: this.xid
				}
				this.$api.reg(data, res => {
					// uni.setStorageSync('userToken', res.data)
					if (res.status) {
				
						uni.removeStorageSync('invitecode')
						uni.$u.toast('注册成功，请前往APP登陆')
						
					} else {
						uni.$u.toast(res.msg)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep .u-checkbox__icon-wrap {
		border-color: #F2D7AAFF !important;
	}


	.Top {
		padding-top: 213rpx;
		text-align: center;

		.Title {
			margin-top: 30rpx;
			margin-bottom: 116rpx;
			font-size: 36rpx;
			color: #fff;
		}
	}

	.Form {
		padding: 0 60rpx;

		.Item {
			display: flex;
			align-items: flex-start;
			height: 93rpx;
			border-bottom: 1rpx solid #b9b9b950;
			margin-bottom: 48rpx;

			.Left {
				width: 110rpx;
				font-weight: bold;
				color: #fff;
				margin-right: 30rpx;
			}

			.Input {
				display: flex;
				align-items: flex-start;
				font-weight: bold;
				color: #202126;

				.Code {
					font-size: 24rpx;
					color: #181818FF;
					width: 166rpx;
					height: 60rpx;
					background: linear-gradient(180deg, #F2D7AA 0%, #DEBC86 100%);
					border-radius: 10rpx;
					line-height: 60rpx;
					text-align: center;
					font-weight: 400;
				}
			}
		}
	}

	.Btn {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: calc(202rpx - 48rpx);

		.BtnC {
			width: 629rpx;
			height: 95rpx;
			background: linear-gradient(180deg, #F2D7AA 0%, #DEBC86 100%);
			opacity: 1;
			border-radius: 10rpx;
			font-size: 36rpx;
			font-weight: bold;
			font-size: 36rpx;
			color: #181818FF;
			text-align: center;
			line-height: 95rpx;
		}
	}

	.XY {
		display: flex;
		align-items: center;
		margin-left: 117rpx;
		margin-top: 37rpx;

		.Tips {
			font-size: 24rpx;
			color: #FFFFFFFF;

			text {
				color: #F2D7AAFF;
			}
		}
	}
</style>